import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test02 {
    public static void main(String[] args) {
        File f1=new File("C:\\Users\\sun\\Desktop\\temp.txt");
        System.out.println(f1.exists());
        System.out.println(f1.isFile());
        System.out.println(f1.isDirectory());
        System.out.println(f1.length());
        System.out.println(f1.lastModified());  // long time最后修改时间
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(sdf.format(f1.lastModified()));
        System.out.println(f1.getName());
        System.out.println(f1.getPath());  // 获得创建文件对象时的路径
        System.out.println(f1.getAbsolutePath());
    }
}
